<#include
"admin/common/include/sysparam.html">
<script type="text/javascript">
	function uploadScreenPic() { 
		ajax.upload({
			fileEleId : 'screenUpfile',
			filePathId : 'screenImageUrl',
			successFn : function(data) {
				var isImg = /\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/
						.test(data.result.webfilePath);
				if (isImg)
					$('#screenImgShow').attr("src", data.result.webfilePath);
			}
		})

	}
</script>

<div id="navModel" class="modal hide fade" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true" >
	<div class="modal-header green">
	 
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
		<h4 id="myModalLabel">
			<strong>导航栏编辑</strong>
		</h4>
	</div>
	<div class="alert alert-error " id="screenErrtip" style="display: none;"></div>

	<div class="modal-body" style="max-height: 550px;">
		<!-- BEGIN FORM-->
		<form action="${contextPath}/Admin-ResScreenShot-save.action"
			id="ResScreenShotAddForm" class="form-horizontal" method="post">
			<input type="hidden" name="id" value="${(resScreenBean.id)?if_exists}" />
			<input type="hidden" name="resourceId" id="resourceId" value="${resourceId}" /> 
			<div class="control-group">
				<label class="control-label">标题<span class="required">*</span></label>
				<div class="controls">
					<input type="text" name="name" id="name" require="true"
						datatype="require"  msg="标题不能为空"
						class="m-wrap medium" value="${(resScreenBean.name)?if_exists}" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">资源图片</label>
				<div class="controls">
				  <#if resScreenBean?? && resScreenBean.imageUrl ?? >
				  <img src="${contextPath}${(resScreenBean.imageUrl)?if_exists}" width="80" height="80"
						id="screenImgShow" />
				<#else> 
					 <img src="${contextPath}/common/image/default-pic.png" width="80" height="80"
						id="screenImgShow" />
				 </#if>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label"></label>
				<div class="controls">
					<span class="btn  fileinput-button"> <i
						class="icon-plus icon-white"></i> <span>选择文件...</span> <input
						type="file" id="screenUpfile" name="screenUpfile" />
					</span> <input type="hidden" id="screenImageUrl" name="imageUrl" value="${(resScreenBean.imageUrl)?if_exists}"  /> <a
						class="btn start" onclick="uploadScreenPic();"> <i
						class="icon-upload icon-white"></i> <span>上传</span>
					</a> <br> <span class="alert alert-error" id="screenUpfile_error_tip"
						style="display: none;"></span>
					<div class="alert alert-success" id="screenUpfile_detail"
						style="display: none;">
						<div class="fileName">
							文件名称:<span></span>
						</div>
						<div class="fileSize">
							文件大小:<span></span>
						</div>
					</div>

				</div>
			</div>
		 
			<div class="control-group">
				<label class="control-label">排位&nbsp;&nbsp;</label>
				<div class="controls">
					<input name="rank" type="text" class="m-wrap medium"
						value="${(resScreenBean.rank)?if_exists}" require="true" datatype="require"
						msg="排位不能为空" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">是否有效<span class="required">*</span></label>
				<div class="controls"><@select paramCode=iseffCode
					value=(resScreenBean.iseff)?if_exists item=' name="iseff" require="true"
					datatype="require" msg="是否有效不能为空"'/></div>
			</div>

			<div class="modal-footer">
				<button type="button" id="screen_save_btn" class="btn blue">保存</button>
				<button class="btn " data-dismiss="modal" aria-hidden="true">关闭</button>
			</div>
		</form>
		<!-- END FORM-->
	</div>
</div>

<script>
	jQuery(document).ready(function() {
	  
		tableAction.initSaveAction({
			formId : 'ResScreenShotAddForm',
			queryUrl : '${contextPath}/Admin-ResScreenShot-show.action?_QUERY_n_eq_resource_id='+$('#resourceId').val(),
			saveUrl : '${contextPath}/Admin-ResScreenShot-save.action',
			saveBtnId : 'screen_save_btn',
			areaId:'screenshotShowDiv',
			errZoneId:'screenErrtip',
			afterSaveFn:function(){ 
				$('#resscreenshotTab').trigger("click"); 
			}
		});
	});
</script>